package com.leet.code.lcof;

public class Code58_1 {
    public static void main(String[] args) {

    }


    public String reverseWords(String s) {
        if (s == null || s.trim().equals("")) {
            return "";
        }
        String[] ss = s.split(" ");
        StringBuilder sb = new StringBuilder();
        for (int i = ss.length - 1; i >= 0; i--) {
            if (ss[i].equals("")) {
                continue;
            }
            sb.append(ss[i]).append(" ");
        }
        return sb.substring(0, sb.length() - 1);

    }



}
